import java.io.*;
import java.util.Scanner;

/*
 ID: ning yusui
 LANG: JAVA
 TASK: fence
 */

public class fence {
    Scanner in;
    PrintWriter out;
    private static final int SIZE = 501;
    private int points;

    public fence() throws IOException {
        in = new Scanner(new File(this.getClass().getName() + ".in"));
        out = new PrintWriter(new BufferedWriter(new FileWriter(this.getClass().getName() +
                ".out")));
    }

    private void work() {
        int dij[][] = new int[SIZE][SIZE];
        int edgeCount[] = new int[SIZE];
        input(dij, edgeCount);
        int start = findStart(edgeCount);
        out.println(start);
        while(edgeCount[start]>0){
            start = findNext(dij, edgeCount, start);
            out.println(start);
        }
        out.flush();
        out.close();
    }

    private void input(int[][] dij, int[] edgeCount) {
        points = in.nextInt();
        for (int i = 0; i < points; i++) {
            int u = in.nextInt();
            int v = in.nextInt();
            dij[u][v]++;
            dij[v][u]++;
            edgeCount[u]++;
            edgeCount[v]++;
        }
    }

    private int findStart(int[] edgeCount) {
        for (int i = 1; i < edgeCount.length; i++) {
            if (edgeCount[i] % 2 == 1) {
                return i;
            }
        }
        return 1;
    }

    private int findNext(int[][] dij, int[] edgeCount, int start) {
        for (int i = 1; i <= points; i++) {
            if(dij[start][i]>0){
                dij[start][i]--;
                dij[i][start]--;
                edgeCount[start]--;
                edgeCount[i]--;
                return i;
            }
        }
        return 0;
    }


    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        new fence().work();
        System.out.println(System.currentTimeMillis() - start + "ms");
    }
}
